﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;

namespace Tetris.Model
{
    public class BlockModel: IBlockModel //to powinien byc tylko pojedynczy kwadracik
    {
        #region IBlockModel implementation

        public void CopyFrom(IBlockModel blockModel)
        {
            this.Top = blockModel.Top;
            this.Left = blockModel.Left;
            this.Height = blockModel.Height;
            this.Width = blockModel.Width;
        }

        private int _top;
        public int Top
        { 
            get
            {
                return this._top;
            }
            set
            {
                this._top = value;
                this.Notify("Top");
            }
        }

        private int _left;
        public int Left
        {
            get
            {
                return this._left;
            }
            set
            {
                this._left = value;
                this.Notify("Left");
            }
        }

        private int _height;
        public int Height
        {
            get
            {
                return this._height;    
            } 
            set
            {
                this._height = value;
                this.Notify("Height");
            }
        }

        private int _width;
        public int Width
        {
            get
            {
                return this._width;
            } 
            set
            {
                this._width = value;   
                this.Notify("Width");
            }
        }

        #endregion

        #region INotifyPropertyChanged implementation

        public event PropertyChangedEventHandler PropertyChanged;

        public void Notify(string propertyName)
        {
            if(PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName) );
            }
        }

        #endregion
    }
}
